And drop our compatibility wrapper.
libotutil_la_SOURCES = \
src/libotutil/ot-checksum-utils.c \
src/libotutil/ot-checksum-utils.h \
- src/libotutil/ot-local-alloc.h \
src/libotutil/ot-keyfile-utils.c \
src/libotutil/ot-keyfile-utils.h \
src/libotutil/ot-opt-utils.c \
gboolean ret = FALSE;
const char *path;
ssize_t bytes_read;
- ot_lvariant GVariant *ret_xattrs = NULL;
- ot_lfree char *xattr_names = NULL;
- ot_lfree char *xattr_names_canonical = NULL;
+ gs_unref_variant GVariant *ret_xattrs = NULL;
+ gs_free char *xattr_names = NULL;
+ gs_free char *xattr_names_canonical = NULL;
GVariantBuilder builder;
gboolean builder_initialized = FALSE;
guint32 rdev;
const char *symlink_target;
GVariant *ret;
- ot_lvariant GVariant *tmp_xattrs = NULL;
+ gs_unref_variant GVariant *tmp_xattrs = NULL;
uid = g_file_info_get_attribute_uint32 (file_info, "unix::uid");
gid = g_file_info_get_attribute_uint32 (file_info, "unix::gid");
guint32 rdev;
const char *symlink_target;
GVariant *ret;
- ot_lvariant GVariant *tmp_xattrs = NULL;
+ gs_unref_variant GVariant *tmp_xattrs = NULL;
size = g_file_info_get_size (file_info);
uid = g_file_info_get_attribute_uint32 (file_info, "unix::uid");
gboolean ret = FALSE;
gpointer header_data;
gsize header_size;
- ot_lobj GInputStream *ret_input = NULL;
- ot_lvariant GVariant *file_header = NULL;
- ot_lptrarray GPtrArray *streams = NULL;
- ot_lobj GOutputStream *header_out_stream = NULL;
- ot_lobj GInputStream *header_in_stream = NULL;
+ gs_unref_object GInputStream *ret_input = NULL;
+ gs_unref_variant GVariant *file_header = NULL;
+ gs_unref_ptrarray GPtrArray *streams = NULL;
+ gs_unref_object GOutputStream *header_out_stream = NULL;
+ gs_unref_object GInputStream *header_in_stream = NULL;
file_header = ostree_file_header_new (file_info, xattrs);
guint32 archive_header_size;
guchar dummy[4];
gsize bytes_read;
- ot_lobj GInputStream *ret_input = NULL;
- ot_lobj GFileInfo *content_file_info = NULL;
- ot_lobj GFileInfo *ret_file_info = NULL;
- ot_lvariant GVariant *ret_xattrs = NULL;
- ot_lvariant GVariant *file_header = NULL;
- ot_lfree guchar *buf = NULL;
+ gs_unref_object GInputStream *ret_input = NULL;
+ gs_unref_object GFileInfo *content_file_info = NULL;
+ gs_unref_object GFileInfo *ret_file_info = NULL;
+ gs_unref_variant GVariant *ret_xattrs = NULL;
+ gs_unref_variant GVariant *file_header = NULL;
+ gs_free guchar *buf = NULL;
if (!g_input_stream_read_all (input,
&archive_header_size, 4, &bytes_read,
**/
if (compressed)
{
- ot_lobj GConverter *zlib_decomp = (GConverter*)g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW);
+ gs_unref_object GConverter *zlib_decomp = (GConverter*)g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW);
ret_input = g_converter_input_stream_new (input, zlib_decomp);
}
else
gboolean ret = FALSE;
guint64 length;
struct stat stbuf;
- ot_lobj GInputStream *file_input = NULL;
- ot_lobj GInputStream *ret_input = NULL;
- ot_lobj GFileInfo *ret_file_info = NULL;
- ot_lvariant GVariant *ret_xattrs = NULL;
+ gs_unref_object GInputStream *file_input = NULL;
+ gs_unref_object GInputStream *ret_input = NULL;
+ gs_unref_object GFileInfo *ret_file_info = NULL;
+ gs_unref_variant GVariant *ret_xattrs = NULL;
if (out_input)
{
GError **error)
{
gboolean ret = FALSE;
- ot_lfree guchar *ret_csum = NULL;
+ gs_free guchar *ret_csum = NULL;
GChecksum *checksum = NULL;
checksum = g_checksum_new (G_CHECKSUM_SHA256);
}
else if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
{
- ot_lvariant GVariant *dirmeta = ostree_create_directory_metadata (file_info, xattrs);
+ gs_unref_variant GVariant *dirmeta = ostree_create_directory_metadata (file_info, xattrs);
g_checksum_update (checksum, g_variant_get_data (dirmeta),
g_variant_get_size (dirmeta));
}
else
{
- ot_lvariant GVariant *file_header = NULL;
+ gs_unref_variant GVariant *file_header = NULL;
file_header = ostree_file_header_new (file_info, xattrs);
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFileInfo *file_info = NULL;
- ot_lobj GInputStream *in = NULL;
- ot_lvariant GVariant *xattrs = NULL;
- ot_lfree guchar *ret_csum = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
+ gs_unref_object GInputStream *in = NULL;
+ gs_unref_variant GVariant *xattrs = NULL;
+ gs_free guchar *ret_csum = NULL;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
gboolean ret = FALSE;
guint32 uid, gid, mode, rdev;
const char *symlink_target;
- ot_lobj GFileInfo *ret_file_info = NULL;
- ot_lvariant GVariant *ret_xattrs = NULL;
+ gs_unref_object GFileInfo *ret_file_info = NULL;
+ gs_unref_variant GVariant *ret_xattrs = NULL;
g_variant_get (metadata, "(uuuu&s@a(ayay))",
&uid, &gid, &mode, &rdev,
guint64 size;
guint32 uid, gid, mode, rdev;
const char *symlink_target;
- ot_lobj GFileInfo *ret_file_info = NULL;
- ot_lvariant GVariant *ret_xattrs = NULL;
+ gs_unref_object GFileInfo *ret_file_info = NULL;
+ gs_unref_variant GVariant *ret_xattrs = NULL;
g_variant_get (metadata, "(tuuuu&s@a(ayay))", &size,
&uid, &gid, &mode, &rdev,
gboolean ret = FALSE;
const char *dest_path;
guint32 uid, gid, mode;
- ot_lobj GFileOutputStream *out = NULL;
+ gs_unref_object GFileOutputStream *out = NULL;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
gboolean ret = FALSE;
GError *temp_error = NULL;
int i = 0;
- ot_lobj GFile *possible_file = NULL;
- ot_lfree guchar *ret_csum = NULL;
+ gs_unref_object GFile *possible_file = NULL;
+ gs_free guchar *ret_csum = NULL;
/* 128 attempts seems reasonable... */
for (i = 0; i < 128; i++)
{
- ot_lfree char *possible_name = NULL;
+ gs_free char *possible_name = NULL;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
goto out;
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFile *ret_file = NULL;
- ot_lobj GOutputStream *ret_stream = NULL;
+ gs_unref_object GFile *ret_file = NULL;
+ gs_unref_object GOutputStream *ret_stream = NULL;
if (!ostree_create_temp_file_from_input (dir, prefix, suffix, NULL, NULL, NULL,
&ret_file, cancellable, error))
GError **error)
{
gboolean ret = FALSE;
- ot_lfree char *template = NULL;
- ot_lobj GFile *ret_file = NULL;
+ gs_free char *template = NULL;
+ gs_unref_object GFile *ret_file = NULL;
if (dir == NULL)
dir = g_file_new_for_path (g_get_tmp_dir ());
GError **error)
{
gboolean ret = FALSE;
- ot_lvariant GVariant *parent_csum_v = NULL;
- ot_lvariant GVariant *content_csum_v = NULL;
- ot_lvariant GVariant *metadata_csum_v = NULL;
+ gs_unref_variant GVariant *parent_csum_v = NULL;
+ gs_unref_variant GVariant *content_csum_v = NULL;
+ gs_unref_variant GVariant *metadata_csum_v = NULL;
gsize n_elts;
if (!validate_variant (commit, OSTREE_COMMIT_GVARIANT_FORMAT, error))
{
gboolean ret = FALSE;
const char *filename;
- ot_lvariant GVariant *content_csum_v = NULL;
- ot_lvariant GVariant *meta_csum_v = NULL;
+ gs_unref_variant GVariant *content_csum_v = NULL;
+ gs_unref_variant GVariant *meta_csum_v = NULL;
GVariantIter *contents_iter = NULL;
if (!validate_variant (dirtree, OSTREE_TREE_GVARIANT_FORMAT, error))
GError **error)
{
gboolean ret = FALSE;
- ot_lfree char *ret_checksum = NULL;
- ot_lfree guchar *csum = NULL;
+ gs_free char *ret_checksum = NULL;
+ gs_free guchar *csum = NULL;
if (OSTREE_IS_REPO_FILE (f))
{
GError **error)
{
gboolean ret = FALSE;
- ot_lfree char *checksum_a = NULL;
- ot_lfree char *checksum_b = NULL;
+ gs_free char *checksum_a = NULL;
+ gs_free char *checksum_b = NULL;
OstreeDiffItem *ret_item = NULL;
if (!get_file_checksum (a, a_info, &checksum_a, cancellable, error))
{
gboolean ret = FALSE;
GError *temp_error = NULL;
- ot_lobj GFileEnumerator *dir_enum = NULL;
- ot_lobj GFile *child = NULL;
- ot_lobj GFileInfo *child_info = NULL;
+ gs_unref_object GFileEnumerator *dir_enum = NULL;
+ gs_unref_object GFile *child = NULL;
+ gs_unref_object GFileInfo *child_info = NULL;
dir_enum = g_file_enumerate_children (d, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
{
gboolean ret = FALSE;
GError *temp_error = NULL;
- ot_lobj GFileEnumerator *dir_enum = NULL;
- ot_lobj GFile *child_a = NULL;
- ot_lobj GFile *child_b = NULL;
- ot_lobj GFileInfo *child_a_info = NULL;
- ot_lobj GFileInfo *child_b_info = NULL;
+ gs_unref_object GFileEnumerator *dir_enum = NULL;
+ gs_unref_object GFile *child_a = NULL;
+ gs_unref_object GFile *child_b = NULL;
+ gs_unref_object GFileInfo *child_a_info = NULL;
+ gs_unref_object GFileInfo *child_b_info = NULL;
child_a_info = g_file_query_info (a, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
GError **error)
{
gboolean ret = FALSE;
- ot_lobj OstreeMutableTree *ret_dir = NULL;
+ gs_unref_object OstreeMutableTree *ret_dir = NULL;
g_return_val_if_fail (name != NULL, FALSE);
GError **error)
{
gboolean ret = FALSE;
- ot_lobj OstreeMutableTree *ret_subdir = NULL;
- ot_lfree char *ret_file_checksum = NULL;
+ gs_unref_object OstreeMutableTree *ret_subdir = NULL;
+ gs_free char *ret_file_checksum = NULL;
ret_subdir = ot_gobject_refz (g_hash_table_lookup (self->subdirs, name));
if (!ret_subdir)
gboolean ret = FALSE;
int i;
OstreeMutableTree *subdir = self; /* nofree */
- ot_lobj OstreeMutableTree *ret_parent = NULL;
+ gs_unref_object OstreeMutableTree *ret_parent = NULL;
g_assert (metadata_checksum != NULL);
GError **error)
{
gboolean ret = FALSE;
- ot_lvariant GVariant *commit = NULL;
- ot_lvariant GVariant *root_contents = NULL;
- ot_lvariant GVariant *root_metadata = NULL;
- ot_lvariant GVariant *tree_contents_csum_v = NULL;
- ot_lvariant GVariant *tree_metadata_csum_v = NULL;
+ gs_unref_variant GVariant *commit = NULL;
+ gs_unref_variant GVariant *root_contents = NULL;
+ gs_unref_variant GVariant *root_metadata = NULL;
+ gs_unref_variant GVariant *tree_contents_csum_v = NULL;
+ gs_unref_variant GVariant *tree_metadata_csum_v = NULL;
g_assert (self->parent == NULL);
gboolean ret = FALSE;
gboolean is_dir;
int i;
- ot_lvariant GVariant *container = NULL;
- ot_lvariant GVariant *tree_contents = NULL;
- ot_lvariant GVariant *tree_metadata = NULL;
- ot_lvariant GVariant *content_csum_v = NULL;
- ot_lvariant GVariant *metadata_csum_v = NULL;
- ot_lfree char *tmp_checksum = NULL;
+ gs_unref_variant GVariant *container = NULL;
+ gs_unref_variant GVariant *tree_contents = NULL;
+ gs_unref_variant GVariant *tree_metadata = NULL;
+ gs_unref_variant GVariant *content_csum_v = NULL;
+ gs_unref_variant GVariant *metadata_csum_v = NULL;
+ gs_free char *tmp_checksum = NULL;
i = ostree_repo_file_tree_find_child (self->parent, self->name, &is_dir, &container);
GError **error)
{
gboolean ret = FALSE;
- ot_lvariant GVariant *ret_xattrs = NULL;
+ gs_unref_variant GVariant *ret_xattrs = NULL;
if (!ostree_repo_file_ensure_resolved (self, error))
goto out;
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFileInfo *ret_info = NULL;
- ot_lvariant GVariant *metadata = NULL;
+ gs_unref_object GFileInfo *ret_info = NULL;
+ gs_unref_variant GVariant *metadata = NULL;
ret_info = g_file_info_new ();
imin = 0;
while (imax >= imin)
{
- ot_lvariant GVariant *child = NULL;
+ gs_unref_variant GVariant *child = NULL;
const char *cur;
int cmp;
gboolean ret = FALSE;
const char *name = NULL;
int c;
- ot_lobj GFileInfo *ret_info = NULL;
- ot_lvariant GVariant *files_variant = NULL;
- ot_lvariant GVariant *dirs_variant = NULL;
- ot_lvariant GVariant *tree_child_metadata = NULL;
- ot_lvariant GVariant *content_csum_v = NULL;
- ot_lvariant GVariant *meta_csum_v = NULL;
+ gs_unref_object GFileInfo *ret_info = NULL;
+ gs_unref_variant GVariant *files_variant = NULL;
+ gs_unref_variant GVariant *dirs_variant = NULL;
+ gs_unref_variant GVariant *tree_child_metadata = NULL;
+ gs_unref_variant GVariant *content_csum_v = NULL;
+ gs_unref_variant GVariant *meta_csum_v = NULL;
char tmp_checksum[65];
GFileAttributeMatcher *matcher = NULL;
{
gboolean ret = FALSE;
OstreeRepoFile *self = OSTREE_REPO_FILE (file);
- ot_lobj GFileInfo *info = NULL;
+ gs_unref_object GFileInfo *info = NULL;
if (!ostree_repo_file_ensure_resolved (self, error))
goto out;
gboolean ret = FALSE;
OstreeRepoFile *self = OSTREE_REPO_FILE (file);
const char *checksum;
- ot_lobj GFile *local_file = NULL;
- ot_lobj GInputStream *ret_stream = NULL;
+ gs_unref_object GFile *local_file = NULL;
+ gs_unref_object GInputStream *ret_stream = NULL;
if (!ostree_repo_file_ensure_resolved (self, error))
goto out;
{
gboolean ret = FALSE;
GError *temp_error = NULL;
- ot_lfree char *rev = NULL;
+ gs_free char *rev = NULL;
if ((rev = gs_file_load_contents_utf8 (f, NULL, &temp_error)) == NULL)
goto out;
if (g_str_has_prefix (rev, "ref: "))
{
- ot_lobj GFile *ref = NULL;
+ gs_unref_object GFile *ref = NULL;
char *ref_sha256;
gboolean subret;
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFileEnumerator *dir_enum = NULL;
- ot_lobj GFile *ret_file = NULL;
+ gs_unref_object GFileEnumerator *dir_enum = NULL;
+ gs_unref_object GFile *ret_file = NULL;
dir_enum = g_file_enumerate_children (self->remote_heads_dir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
gboolean ret = FALSE;
__attribute__((unused)) GCancellable *cancellable = NULL;
GError *temp_error = NULL;
- ot_lfree char *tmp = NULL;
- ot_lfree char *tmp2 = NULL;
- ot_lfree char *ret_rev = NULL;
- ot_lobj GFile *child = NULL;
- ot_lobj GFile *origindir = NULL;
+ gs_free char *tmp = NULL;
+ gs_free char *tmp2 = NULL;
+ gs_free char *ret_rev = NULL;
+ gs_unref_object GFile *child = NULL;
+ gs_unref_object GFile *origindir = NULL;
g_return_val_if_fail (ref != NULL, FALSE);
gboolean ret = FALSE;
gsize bytes_written;
int i;
- ot_lobj GFile *parent = NULL;
- ot_lobj GFile *child = NULL;
- ot_lobj GOutputStream *out = NULL;
- ot_lptrarray GPtrArray *components = NULL;
+ gs_unref_object GFile *parent = NULL;
+ gs_unref_object GFile *child = NULL;
+ gs_unref_object GOutputStream *out = NULL;
+ gs_unref_ptrarray GPtrArray *components = NULL;
if (!ostree_validate_checksum_string (sha256, error))
goto out;
GError **error)
{
gboolean ret = FALSE;
- ot_lfree char *data = NULL;
+ gs_free char *data = NULL;
gsize len;
g_return_val_if_fail (self->inited, FALSE);
{
gboolean ret = FALSE;
gboolean is_archive;
- ot_lfree char *version = NULL;
- ot_lfree char *mode = NULL;
- ot_lfree char *parent_repo_path = NULL;
+ gs_free char *version = NULL;
+ gs_free char *mode = NULL;
+ gs_free char *parent_repo_path = NULL;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (parent_repo_path && parent_repo_path[0])
{
- ot_lobj GFile *parent_repo_f = g_file_new_for_path (parent_repo_path);
+ gs_unref_object GFile *parent_repo_f = g_file_new_for_path (parent_repo_path);
self->parent_repo = ostree_repo_new (parent_repo_f);
ostree_repo_get_archive_content_path (OstreeRepo *self,
const char *checksum)
{
- ot_lfree char *path = NULL;
+ gs_free char *path = NULL;
g_assert (ostree_repo_get_mode (self) == OSTREE_REPO_MODE_ARCHIVE);
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFile *parent = NULL;
+ gs_unref_object GFile *parent = NULL;
parent = g_file_get_parent (dest);
if (!gs_file_ensure_directory (parent, FALSE, cancellable, error))
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFile *dest_file = NULL;
+ gs_unref_object GFile *dest_file = NULL;
dest_file = ostree_repo_get_object_path (self, checksum, objtype);
const char *actual_checksum;
gboolean do_commit;
OstreeRepoMode repo_mode;
- ot_lobj GFileInfo *temp_info = NULL;
- ot_lobj GFile *temp_file = NULL;
- ot_lobj GFile *raw_temp_file = NULL;
- ot_lobj GFile *stored_path = NULL;
- ot_lfree guchar *ret_csum = NULL;
- ot_lobj OstreeChecksumInputStream *checksum_input = NULL;
+ gs_unref_object GFileInfo *temp_info = NULL;
+ gs_unref_object GFile *temp_file = NULL;
+ gs_unref_object GFile *raw_temp_file = NULL;
+ gs_unref_object GFile *stored_path = NULL;
+ gs_free guchar *ret_csum = NULL;
+ gs_unref_object OstreeChecksumInputStream *checksum_input = NULL;
gboolean have_obj;
GChecksum *checksum = NULL;
gboolean staged_raw_file = FALSE;
if (objtype == OSTREE_OBJECT_TYPE_FILE)
{
- ot_lobj GInputStream *file_input = NULL;
- ot_lobj GFileInfo *file_info = NULL;
- ot_lvariant GVariant *xattrs = NULL;
+ gs_unref_object GInputStream *file_input = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
+ gs_unref_variant GVariant *xattrs = NULL;
if (!ostree_content_stream_parse (FALSE, checksum_input ? (GInputStream*)checksum_input : input,
file_object_length, FALSE,
}
else if (repo_mode == OSTREE_REPO_MODE_ARCHIVE_Z2)
{
- ot_lvariant GVariant *file_meta = NULL;
- ot_lobj GOutputStream *temp_out = NULL;
- ot_lobj GConverter *zlib_compressor = NULL;
- ot_lobj GOutputStream *compressed_out_stream = NULL;
+ gs_unref_variant GVariant *file_meta = NULL;
+ gs_unref_object GOutputStream *temp_out = NULL;
+ gs_unref_object GConverter *zlib_compressor = NULL;
+ gs_unref_object GOutputStream *compressed_out_stream = NULL;
if (!ostree_create_temp_regular_file (self->tmp_dir,
ostree_object_type_to_string (objtype), NULL,
}
else if (repo_mode == OSTREE_REPO_MODE_ARCHIVE)
{
- ot_lvariant GVariant *file_meta = NULL;
- ot_lobj GInputStream *file_meta_input = NULL;
- ot_lobj GFileInfo *archive_content_file_info = NULL;
+ gs_unref_variant GVariant *file_meta = NULL;
+ gs_unref_object GInputStream *file_meta_input = NULL;
+ gs_unref_object GFileInfo *archive_content_file_info = NULL;
file_meta = ostree_file_header_new (file_info, xattrs);
file_meta_input = ot_variant_read (file_meta);
if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
{
- ot_lobj GOutputStream *content_out = NULL;
+ gs_unref_object GOutputStream *content_out = NULL;
guint32 src_mode;
guint32 target_mode;
if (!staged_raw_file
&& objtype == OSTREE_OBJECT_TYPE_FILE && self->mode == OSTREE_REPO_MODE_BARE)
{
- ot_lobj GInputStream *file_input = NULL;
- ot_lobj GFileInfo *file_info = NULL;
- ot_lvariant GVariant *xattrs = NULL;
+ gs_unref_object GInputStream *file_input = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
+ gs_unref_variant GVariant *xattrs = NULL;
gboolean is_regular;
if (!ostree_content_file_parse (FALSE, temp_file, FALSE, &file_input,
/* Commit content first so the process is atomic */
if (staged_archive_file)
{
- ot_lobj GFile *archive_content_dest = NULL;
+ gs_unref_object GFile *archive_content_dest = NULL;
archive_content_dest = ostree_repo_get_archive_content_path (self, actual_checksum);
gboolean ret = FALSE;
guint i;
OstreeRepoMode repo_mode;
- ot_lptrarray GPtrArray *object_dirs = NULL;
- ot_lobj GFile *objdir = NULL;
+ gs_unref_ptrarray GPtrArray *object_dirs = NULL;
+ gs_unref_object GFile *objdir = NULL;
if (self->parent_repo)
{
for (i = 0; i < object_dirs->len; i++)
{
GFile *objdir = object_dirs->pdata[i];
- ot_lobj GFileEnumerator *enumerator = NULL;
- ot_lobj GFileInfo *file_info = NULL;
+ gs_unref_object GFileEnumerator *enumerator = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
const char *dirname;
enumerator = g_file_enumerate_children (objdir, OSTREE_GIO_FAST_QUERYINFO,
GCancellable *cancellable,
GError **error)
{
- ot_lobj GInputStream *input = NULL;
- ot_lvariant GVariant *normalized = NULL;
+ gs_unref_object GInputStream *input = NULL;
+ gs_unref_variant GVariant *normalized = NULL;
normalized = g_variant_get_normal_form (variant);
input = ot_variant_read (normalized);
GCancellable *cancellable,
GError **error)
{
- ot_lobj GInputStream *input = NULL;
- ot_lvariant GVariant *normalized = NULL;
+ gs_unref_object GInputStream *input = NULL;
+ gs_unref_variant GVariant *normalized = NULL;
normalized = g_variant_get_normal_form (variant);
input = ot_variant_read (normalized);
GCancellable *cancellable,
GError **error)
{
- ot_lvariant GVariant *dirmeta = NULL;
+ gs_unref_variant GVariant *dirmeta = NULL;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFileEnumerator *enumerator = NULL;
+ gs_unref_object GFileEnumerator *enumerator = NULL;
enumerator = g_file_enumerate_children (dir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
GHashTableIter hash_iter;
gpointer key, value;
gsize bytes_written;
- ot_lhash GHashTable *all_refs = NULL;
- ot_lobj GFile *summary_path = NULL;
- ot_lobj GOutputStream *out = NULL;
- ot_lfree char *buf = NULL;
+ gs_unref_hashtable GHashTable *all_refs = NULL;
+ gs_unref_object GFile *summary_path = NULL;
+ gs_unref_object GOutputStream *out = NULL;
+ gs_free char *buf = NULL;
if (!ostree_repo_list_refs (self, NULL, &all_refs, cancellable, error))
goto out;
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFile *dir = NULL;
+ gs_unref_object GFile *dir = NULL;
if (remote == NULL)
dir = g_object_ref (self->local_heads_dir);
GError **error)
{
gboolean ret = FALSE;
- ot_lfree char *ret_commit = NULL;
- ot_lvariant GVariant *commit = NULL;
- ot_lfree guchar *commit_csum = NULL;
+ gs_free char *ret_commit = NULL;
+ gs_unref_variant GVariant *commit = NULL;
+ gs_free guchar *commit_csum = NULL;
GDateTime *now = NULL;
g_return_val_if_fail (branch != NULL, FALSE);
gboolean ret = FALSE;
gboolean repo_dir_was_empty = FALSE;
OstreeRepoCommitFilterResult filter_result;
- ot_lobj OstreeRepoFile *repo_dir = NULL;
- ot_lobj GFileEnumerator *dir_enum = NULL;
- ot_lobj GFileInfo *child_info = NULL;
+ gs_unref_object OstreeRepoFile *repo_dir = NULL;
+ gs_unref_object GFileEnumerator *dir_enum = NULL;
+ gs_unref_object GFileInfo *child_info = NULL;
/* We can only reuse checksums directly if there's no modifier */
if (OSTREE_IS_REPO_FILE (dir) && modifier == NULL)
}
else
{
- ot_lobj GFileInfo *modified_info = NULL;
- ot_lvariant GVariant *xattrs = NULL;
- ot_lfree guchar *child_file_csum = NULL;
- ot_lfree char *tmp_checksum = NULL;
+ gs_unref_object GFileInfo *modified_info = NULL;
+ gs_unref_variant GVariant *xattrs = NULL;
+ gs_free guchar *child_file_csum = NULL;
+ gs_free char *tmp_checksum = NULL;
child_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
{
guint64 file_obj_length;
const char *loose_checksum;
- ot_lobj GInputStream *file_input = NULL;
- ot_lvariant GVariant *xattrs = NULL;
- ot_lobj GInputStream *file_object_input = NULL;
- ot_lfree guchar *child_file_csum = NULL;
- ot_lfree char *tmp_checksum = NULL;
+ gs_unref_object GInputStream *file_input = NULL;
+ gs_unref_variant GVariant *xattrs = NULL;
+ gs_unref_object GInputStream *file_object_input = NULL;
+ gs_free guchar *child_file_csum = NULL;
+ gs_free char *tmp_checksum = NULL;
loose_checksum = devino_cache_lookup (self, child_info);
GHashTableIter hash_iter;
gpointer key, value;
const char *existing_checksum;
- ot_lfree char *ret_contents_checksum = NULL;
- ot_lhash GHashTable *dir_metadata_checksums = NULL;
- ot_lhash GHashTable *dir_contents_checksums = NULL;
- ot_lvariant GVariant *serialized_tree = NULL;
- ot_lfree guchar *contents_csum = NULL;
+ gs_free char *ret_contents_checksum = NULL;
+ gs_unref_hashtable GHashTable *dir_metadata_checksums = NULL;
+ gs_unref_hashtable GHashTable *dir_contents_checksums = NULL;
+ gs_unref_variant GVariant *serialized_tree = NULL;
+ gs_free guchar *contents_csum = NULL;
existing_checksum = ostree_mutable_tree_get_contents_checksum (mtree);
if (existing_checksum)
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GInputStream *file_object_input = NULL;
- ot_lobj GInputStream *archive_stream = NULL;
+ gs_unref_object GInputStream *file_object_input = NULL;
+ gs_unref_object GInputStream *archive_stream = NULL;
guint64 length;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
const char *pathname;
const char *hardlink;
const char *basename;
- ot_lobj GFileInfo *file_info = NULL;
- ot_lptrarray GPtrArray *split_path = NULL;
- ot_lptrarray GPtrArray *hardlink_split_path = NULL;
- ot_lobj OstreeMutableTree *subdir = NULL;
- ot_lobj OstreeMutableTree *parent = NULL;
- ot_lobj OstreeMutableTree *hardlink_source_parent = NULL;
- ot_lfree char *hardlink_source_checksum = NULL;
- ot_lobj OstreeMutableTree *hardlink_source_subdir = NULL;
- ot_lfree guchar *tmp_csum = NULL;
- ot_lfree char *tmp_checksum = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
+ gs_unref_ptrarray GPtrArray *split_path = NULL;
+ gs_unref_ptrarray GPtrArray *hardlink_split_path = NULL;
+ gs_unref_object OstreeMutableTree *subdir = NULL;
+ gs_unref_object OstreeMutableTree *parent = NULL;
+ gs_unref_object OstreeMutableTree *hardlink_source_parent = NULL;
+ gs_free char *hardlink_source_checksum = NULL;
+ gs_unref_object OstreeMutableTree *hardlink_source_subdir = NULL;
+ gs_free guchar *tmp_csum = NULL;
+ gs_free char *tmp_checksum = NULL;
pathname = archive_entry_pathname (entry);
struct archive *a = NULL;
struct archive_entry *entry;
int r;
- ot_lobj GFileInfo *tmp_dir_info = NULL;
- ot_lfree guchar *tmp_csum = NULL;
+ gs_unref_object GFileInfo *tmp_dir_info = NULL;
+ gs_free guchar *tmp_csum = NULL;
a = archive_read_new ();
archive_read_support_compression_all (a);
{
gboolean ret = FALSE;
guint i;
- ot_lptrarray GPtrArray *object_dirs = NULL;
- ot_lobj GFile *objdir = NULL;
+ gs_unref_ptrarray GPtrArray *object_dirs = NULL;
+ gs_unref_object GFile *objdir = NULL;
if (!get_loose_object_dirs (self, &object_dirs, cancellable, error))
goto out;
{
gboolean ret = FALSE;
OstreeRepoMode repo_mode;
- ot_lvariant GVariant *file_data = NULL;
- ot_lobj GFile *loose_path = NULL;
- ot_lobj GFileInfo *content_loose_info = NULL;
- ot_lobj GInputStream *ret_input = NULL;
- ot_lobj GFileInfo *ret_file_info = NULL;
- ot_lvariant GVariant *ret_xattrs = NULL;
+ gs_unref_variant GVariant *file_data = NULL;
+ gs_unref_object GFile *loose_path = NULL;
+ gs_unref_object GFileInfo *content_loose_info = NULL;
+ gs_unref_object GInputStream *ret_input = NULL;
+ gs_unref_object GFileInfo *ret_file_info = NULL;
+ gs_unref_variant GVariant *ret_xattrs = NULL;
if (!repo_find_object (self, OSTREE_OBJECT_TYPE_FILE, checksum, &loose_path,
cancellable, error))
{
case OSTREE_REPO_MODE_ARCHIVE:
{
- ot_lvariant GVariant *archive_meta = NULL;
+ gs_unref_variant GVariant *archive_meta = NULL;
if (!ot_util_variant_map (loose_path, OSTREE_FILE_HEADER_GVARIANT_FORMAT,
TRUE, &archive_meta, error))
if (g_file_info_get_file_type (ret_file_info) == G_FILE_TYPE_REGULAR)
{
- ot_lobj GFile *archive_content_path = NULL;
- ot_lobj GFileInfo *content_info = NULL;
+ gs_unref_object GFile *archive_content_path = NULL;
+ gs_unref_object GFileInfo *content_info = NULL;
archive_content_path = ostree_repo_get_archive_content_path (self, checksum);
content_info = g_file_query_info (archive_content_path, OSTREE_GIO_FAST_QUERYINFO,
{
gboolean ret = FALSE;
struct stat stbuf;
- ot_lobj GFile *object_path = NULL;
- ot_lobj GFile *ret_stored_path = NULL;
+ gs_unref_object GFile *object_path = NULL;
+ gs_unref_object GFile *ret_stored_path = NULL;
object_path = ostree_repo_get_object_path (self, checksum, objtype);
{
gboolean ret = FALSE;
gboolean ret_have_object;
- ot_lobj GFile *loose_path = NULL;
+ gs_unref_object GFile *loose_path = NULL;
if (!repo_find_object (self, objtype, checksum, &loose_path,
cancellable, error))
GError **error)
{
gboolean ret = FALSE;
- ot_lfree char *checksum = NULL;
+ gs_free char *checksum = NULL;
checksum = ostree_checksum_from_bytes (csum);
{
gboolean ret = FALSE;
GCancellable *cancellable = NULL;
- ot_lobj GFile *object_path = NULL;
- ot_lvariant GVariant *ret_variant = NULL;
+ gs_unref_object GFile *object_path = NULL;
+ gs_unref_variant GVariant *ret_variant = NULL;
g_return_val_if_fail (OSTREE_OBJECT_TYPE_IS_META (objtype), FALSE);
GError **error)
{
gboolean ret = FALSE;
- ot_lhash GHashTable *ret_objects = NULL;
+ gs_unref_hashtable GHashTable *ret_objects = NULL;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (self->inited, FALSE);
{
gboolean ret = FALSE;
GError *temp_error = NULL;
- ot_lobj GFile *dir = NULL;
- ot_lobj GFile *temp_file = NULL;
- ot_lobj GFileInfo *temp_info = NULL;
+ gs_unref_object GFile *dir = NULL;
+ gs_unref_object GFile *temp_file = NULL;
+ gs_unref_object GFileInfo *temp_info = NULL;
if (mode == OSTREE_REPO_CHECKOUT_MODE_USER)
{
{
gboolean ret = FALSE;
gboolean ret_was_supported = FALSE;
- ot_lobj GFile *dir = NULL;
+ gs_unref_object GFile *dir = NULL;
again:
if (dirfd != -1 &&
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFile *path = NULL;
+ gs_unref_object GFile *path = NULL;
struct stat stbuf;
do
gboolean hardlink_supported;
GError *local_error = NULL;
GError **error = &local_error;
- ot_lobj GFile *loose_path = NULL;
- ot_lobj GInputStream *input = NULL;
- ot_lvariant GVariant *xattrs = NULL;
+ gs_unref_object GFile *loose_path = NULL;
+ gs_unref_object GInputStream *input = NULL;
+ gs_unref_variant GVariant *xattrs = NULL;
CheckoutOneFileAsyncData *checkout_data;
checkout_data = g_simple_async_result_get_op_res_gpointer (result);
&& checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_USER
&& repo->enable_uncompressed_cache)
{
- ot_lobj GFile *objdir = NULL;
+ gs_unref_object GFile *objdir = NULL;
loose_path = get_uncompressed_object_cache_path (repo, checksum);
if (!ostree_repo_load_file (repo, checksum, &input, NULL, &xattrs,
{
GFileInfo *file_info = data->pending_dirs->pdata[i];
const char *name;
- ot_lobj GFile *dest_path = NULL;
- ot_lobj GFile *src_child = NULL;
+ gs_unref_object GFile *dest_path = NULL;
+ gs_unref_object GFile *src_child = NULL;
name = g_file_info_get_attribute_byte_string (file_info, "standard::name");
if (type != G_FILE_TYPE_DIRECTORY)
{
- ot_lobj GFile *dest_path = NULL;
- ot_lobj GFile *src_child = NULL;
+ gs_unref_object GFile *dest_path = NULL;
+ gs_unref_object GFile *src_child = NULL;
dest_path = g_file_get_child (data->destination, name);
src_child = g_file_get_child ((GFile*)data->source, name);
gpointer user_data)
{
CheckoutTreeAsyncData *checkout_data;
- ot_lobj GFileInfo *file_info = NULL;
- ot_lvariant GVariant *xattrs = NULL;
- ot_lobj GFileEnumerator *dir_enum = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
+ gs_unref_variant GVariant *xattrs = NULL;
+ gs_unref_object GFileEnumerator *dir_enum = NULL;
GError *local_error = NULL;
GError **error = &local_error;
GError **error)
{
gboolean ret = FALSE;
- ot_lhash GHashTable *to_clean_dirs = NULL;
+ gs_unref_hashtable GHashTable *to_clean_dirs = NULL;
GHashTableIter iter;
gpointer key, value;
g_hash_table_iter_init (&iter, to_clean_dirs);
while (to_clean_dirs && g_hash_table_iter_next (&iter, &key, &value))
{
- ot_lobj GFile *objdir = NULL;
- ot_lobj GFileEnumerator *enumerator = NULL;
- ot_lfree char *objdir_name = NULL;
+ gs_unref_object GFile *objdir = NULL;
+ gs_unref_object GFileEnumerator *enumerator = NULL;
+ gs_free char *objdir_name = NULL;
objdir_name = g_strdup_printf ("%02x", GPOINTER_TO_UINT (key));
objdir = ot_gfile_get_child_build_path (self->uncompressed_objects_dir, "objects",
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFile *ret_root = NULL;
- ot_lfree char *resolved_rev = NULL;
+ gs_unref_object GFile *ret_root = NULL;
+ gs_free char *resolved_rev = NULL;
if (!ostree_repo_resolve_rev (self, rev, FALSE, &resolved_rev, error))
goto out;
{
gboolean ret = FALSE;
int estatus;
- ot_lfree char *rel_triggerdir = NULL;
- ot_lobj GFile *triggerdir = NULL;
- ot_lptrarray GPtrArray *argv = NULL;
+ gs_free char *rel_triggerdir = NULL;
+ gs_unref_object GFile *triggerdir = NULL;
+ gs_unref_ptrarray GPtrArray *argv = NULL;
rel_triggerdir = g_build_filename ("usr", "libexec", "ostree", "triggers.d", NULL);
{
gboolean ret = FALSE;
int n, i;
- ot_lvariant GVariant *key = NULL;
- ot_lvariant GVariant *tree = NULL;
- ot_lvariant GVariant *files_variant = NULL;
- ot_lvariant GVariant *dirs_variant = NULL;
- ot_lvariant GVariant *csum_v = NULL;
- ot_lvariant GVariant *content_csum_v = NULL;
- ot_lvariant GVariant *metadata_csum_v = NULL;
- ot_lfree char *tmp_checksum = NULL;
+ gs_unref_variant GVariant *key = NULL;
+ gs_unref_variant GVariant *tree = NULL;
+ gs_unref_variant GVariant *files_variant = NULL;
+ gs_unref_variant GVariant *dirs_variant = NULL;
+ gs_unref_variant GVariant *csum_v = NULL;
+ gs_unref_variant GVariant *content_csum_v = NULL;
+ gs_unref_variant GVariant *metadata_csum_v = NULL;
+ gs_free char *tmp_checksum = NULL;
if (recursion_depth > OSTREE_MAX_RECURSION)
{
GError **error)
{
gboolean ret = FALSE;
- ot_lfree char*tmp_checksum = NULL;
+ gs_free char*tmp_checksum = NULL;
while (TRUE)
{
gboolean recurse = FALSE;
- ot_lvariant GVariant *parent_csum_bytes = NULL;
- ot_lvariant GVariant *meta_csum_bytes = NULL;
- ot_lvariant GVariant *content_csum_bytes = NULL;
- ot_lvariant GVariant *key = NULL;
- ot_lvariant GVariant *commit = NULL;
+ gs_unref_variant GVariant *parent_csum_bytes = NULL;
+ gs_unref_variant GVariant *meta_csum_bytes = NULL;
+ gs_unref_variant GVariant *content_csum_bytes = NULL;
+ gs_unref_variant GVariant *key = NULL;
+ gs_unref_variant GVariant *commit = NULL;
key = ostree_object_name_serialize (commit_checksum, OSTREE_OBJECT_TYPE_COMMIT);
{
gboolean ret = FALSE;
GChecksum *checksum = NULL;
- ot_lfree guchar *ret_csum = NULL;
+ gs_free guchar *ret_csum = NULL;
checksum = g_checksum_new (G_CHECKSUM_SHA256);
{
va_list args;
const char *arg;
- ot_lfree char *path = NULL;
- ot_lptrarray GPtrArray *components = NULL;
+ gs_free char *path = NULL;
+ gs_unref_ptrarray GPtrArray *components = NULL;
va_start (args, first);
{
va_list args;
const char *arg;
- ot_lfree char *path = NULL;
- ot_lptrarray GPtrArray *components = NULL;
+ gs_free char *path = NULL;
+ gs_unref_ptrarray GPtrArray *components = NULL;
va_start (args, first);
{
gboolean ret = FALSE;
GError *temp_error = NULL;
- ot_lfree char *ret_value;
+ gs_free char *ret_value;
ret_value = g_key_file_get_value (keyfile, section, value, &temp_error);
if (temp_error)
+++ /dev/null
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
- *
- * Copyright (C) 2011 Colin Walters <walters@verbum.org>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Colin Walters <walters@verbum.org>
- */
-
-#ifndef __OSTREE_LOCAL_ALLOC_H__
-#define __OSTREE_LOCAL_ALLOC_H__
-
-#include <gio/gio.h>
-#include "libgsystem.h"
-
-G_BEGIN_DECLS
-
-#define ot_lfree __attribute__ ((cleanup(gs_local_free)))
-#define ot_lobj __attribute__ ((cleanup(gs_local_obj_unref)))
-#define ot_lvariant __attribute__ ((cleanup(gs_local_variant_unref)))
-#define ot_lptrarray __attribute__ ((cleanup(gs_local_ptrarray_unref)))
-#define ot_lhash __attribute__ ((cleanup(gs_local_hashtable_unref)))
-
-G_END_DECLS
-
-#endif
char *argv[2];
int stdin_fd;
pid_t pid;
- ot_lfree GOutputStream *ret_stream = NULL;
+ gs_free GOutputStream *ret_stream = NULL;
if (!isatty (1))
{
{
gboolean ret = FALSE;
int i;
- ot_lptrarray GPtrArray *ret_components = NULL;
+ gs_unref_ptrarray GPtrArray *ret_components = NULL;
if (strlen (path) > PATH_MAX)
{
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GOutputStream *out = NULL;
+ gs_unref_object GOutputStream *out = NULL;
gsize bytes_written;
out = (GOutputStream*)g_file_replace (dest, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION,
GError **error)
{
gboolean ret = FALSE;
- ot_lvariant GVariant *ret_variant = NULL;
+ gs_unref_variant GVariant *ret_variant = NULL;
GMappedFile *mfile = NULL;
mfile = gs_file_map_noatime (src, NULL, error);
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GMemoryOutputStream *data_stream = NULL;
- ot_lvariant GVariant *ret_variant = NULL;
+ gs_unref_object GMemoryOutputStream *data_stream = NULL;
+ gs_unref_variant GVariant *ret_variant = NULL;
data_stream = (GMemoryOutputStream*)g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
} G_STMT_END;
#include <ot-waitable-queue.h>
-#include <ot-local-alloc.h>
#include <ot-keyfile-utils.h>
#include <ot-gio-utils.h>
#include <ot-opt-utils.h>
gpointer user_data)
{
OstreeFetcherPendingURI *pending = user_data;
- ot_lobj GFileInfo *file_info = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
pending->state = OSTREE_FETCHER_STATE_COMPLETE;
file_info = g_file_query_info (pending->tmpfile, OSTREE_GIO_FAST_QUERYINFO,
if (active->tmpfile)
{
- ot_lobj GFileInfo *file_info = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
file_info = g_file_query_info (active->tmpfile, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
NULL, NULL);
if (file_info)
{
- ot_lfree char *size = format_size_pair (g_file_info_get_size (file_info),
+ gs_free char *size = format_size_pair (g_file_info_get_size (file_info),
active->content_length);
g_string_append_printf (buf, " [%s]", size);
}
GError **error)
{
gboolean ret = FALSE;
- ot_lvariant GVariant *key = NULL;
- ot_lobj GFile *objf = NULL;
+ gs_unref_variant GVariant *key = NULL;
+ gs_unref_object GFile *objf = NULL;
key = ostree_object_name_serialize (checksum, objtype);
{
if (!(flags & OSTREE_PRUNE_FLAGS_NO_PRUNE))
{
- ot_lobj GFileInfo *info = NULL;
+ gs_unref_object GFileInfo *info = NULL;
if ((info = g_file_query_info (objf, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
uri_fetch_update_status (gpointer user_data)
{
OtPullData *pull_data = user_data;
- ot_lfree char *fetcher_status = NULL;
+ gs_free char *fetcher_status = NULL;
GString *status;
guint64 current_bytes_transferred;
guint64 current_delta_bytes_transferred;
GError **error)
{
gboolean ret = FALSE;
- ot_lfree char *uri_string = NULL;
- ot_lobj SoupRequest *request = NULL;
+ gs_free char *uri_string = NULL;
+ gs_unref_object SoupRequest *request = NULL;
OstreeFetchUriData fetch_data;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFile *tmpf = NULL;
- ot_lfree char *ret_contents = NULL;
+ gs_unref_object GFile *tmpf = NULL;
+ gs_free char *ret_contents = NULL;
gsize len;
if (!fetch_uri (pull_data, uri, "tmp-", &tmpf, cancellable, error))
{
gboolean ret = FALSE;
int i, n;
- ot_lvariant GVariant *tree = NULL;
- ot_lvariant GVariant *files_variant = NULL;
- ot_lvariant GVariant *dirs_variant = NULL;
- ot_lobj GFile *stored_path = NULL;
+ gs_unref_variant GVariant *tree = NULL;
+ gs_unref_variant GVariant *files_variant = NULL;
+ gs_unref_variant GVariant *dirs_variant = NULL;
+ gs_unref_object GFile *stored_path = NULL;
if (recursion_depth > OSTREE_MAX_RECURSION)
{
{
const char *filename;
gboolean file_is_stored;
- ot_lvariant GVariant *csum = NULL;
- ot_lfree char *file_checksum;
+ gs_unref_variant GVariant *csum = NULL;
+ gs_free char *file_checksum;
g_variant_get_child (files_variant, i, "(&s@ay)", &filename, &csum);
for (i = 0; i < n; i++)
{
const char *dirname;
- ot_lvariant GVariant *tree_csum = NULL;
- ot_lvariant GVariant *meta_csum = NULL;
- ot_lfree char *tmp_checksum = NULL;
+ gs_unref_variant GVariant *tree_csum = NULL;
+ gs_unref_variant GVariant *meta_csum = NULL;
+ gs_free char *tmp_checksum = NULL;
g_variant_get_child (dirs_variant, i, "(&s@ay@ay)",
&dirname, &tree_csum, &meta_csum);
GError **error)
{
gboolean ret = FALSE;
- ot_lfree char *ret_contents = NULL;
+ gs_free char *ret_contents = NULL;
SoupURI *target_uri = NULL;
target_uri = suburi_new (pull_data->base_uri, "refs", "heads", ref, NULL);
GError **error = &local_error;
OstreeObjectType objtype;
const char *expected_checksum;
- ot_lfree guchar *csum = NULL;
- ot_lfree char *checksum = NULL;
+ gs_free guchar *csum = NULL;
+ gs_free char *checksum = NULL;
if (!ostree_repo_stage_content_finish ((OstreeRepo*)object, result,
&csum, error))
GError **error = &local_error;
GCancellable *cancellable = NULL;
guint64 length;
- ot_lvariant GVariant *file_meta = NULL;
- ot_lobj GFileInfo *file_info = NULL;
- ot_lobj GInputStream *content_input = NULL;
- ot_lobj GInputStream *file_object_input = NULL;
- ot_lvariant GVariant *xattrs = NULL;
- ot_lobj GInputStream *file_in = NULL;
- ot_lobj GInputStream *object_input = NULL;
+ gs_unref_variant GVariant *file_meta = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
+ gs_unref_object GInputStream *content_input = NULL;
+ gs_unref_object GInputStream *file_object_input = NULL;
+ gs_unref_variant GVariant *xattrs = NULL;
+ gs_unref_object GInputStream *file_in = NULL;
+ gs_unref_object GInputStream *object_input = NULL;
const char *checksum;
OstreeObjectType objtype;
{
FetchObjectData *fetch_data = user_data;
OtPullData *pull_data = fetch_data->pull_data;
- ot_lvariant GVariant *metadata = NULL;
+ gs_unref_variant GVariant *metadata = NULL;
const char *checksum;
OstreeObjectType objtype;
GError *local_error = NULL;
GError **error)
{
gboolean ret = FALSE;
- ot_lvariant GVariant *commit = NULL;
- ot_lvariant GVariant *related_objects = NULL;
- ot_lvariant GVariant *tree_contents_csum = NULL;
- ot_lvariant GVariant *tree_meta_csum = NULL;
- ot_lfree char *tmp_checksum = NULL;
+ gs_unref_variant GVariant *commit = NULL;
+ gs_unref_variant GVariant *related_objects = NULL;
+ gs_unref_variant GVariant *tree_contents_csum = NULL;
+ gs_unref_variant GVariant *tree_meta_csum = NULL;
+ gs_free char *tmp_checksum = NULL;
GVariantIter *iter = NULL;
if (recursion_depth > OSTREE_MAX_RECURSION)
if (opt_related)
{
const char *name;
- ot_lvariant GVariant *csum_v = NULL;
+ gs_unref_variant GVariant *csum_v = NULL;
related_objects = g_variant_get_child_value (commit, 2);
iter = g_variant_iter_new (related_objects);
GError **error)
{
gboolean ret = FALSE;
- ot_lvariant GVariant *object = NULL;
- ot_lfree char *tmp_checksum = NULL;
+ gs_unref_variant GVariant *object = NULL;
+ gs_free char *tmp_checksum = NULL;
gboolean is_requested;
gboolean is_stored;
{
OstreeObjectType objtype;
const char *checksum = NULL;
- ot_lfree guchar *csum = NULL;
+ gs_free guchar *csum = NULL;
ostree_object_name_deserialize (object, &checksum, &objtype);
csum = ostree_checksum_to_bytes (checksum);
GError **error)
{
gboolean ret = FALSE;
- ot_lhash GHashTable *ret_refs = NULL;
+ gs_unref_hashtable GHashTable *ret_refs = NULL;
char **lines = NULL;
char **iter = NULL;
char *ref = NULL;
gboolean ret = FALSE;
GError *temp_error = NULL;
GKeyFile *config;
- ot_lfree char *ret_value = NULL;
+ gs_free char *ret_value = NULL;
config = ostree_repo_get_config (repo);
GError **error)
{
gboolean ret = FALSE;
- ot_lfree char *contents = NULL;
+ gs_free char *contents = NULL;
GKeyFile *ret_keyfile = NULL;
SoupURI *target_uri = NULL;
gpointer key, value;
int i;
GCancellable *cancellable = NULL;
- ot_lfree char *remote_key = NULL;
- ot_lobj OstreeRepo *repo = NULL;
- ot_lfree char *remote_config_content = NULL;
- ot_lfree char *path = NULL;
- ot_lfree char *baseurl = NULL;
- ot_lfree char *summary_data = NULL;
- ot_lhash GHashTable *requested_refs_to_fetch = NULL;
- ot_lhash GHashTable *updated_refs = NULL;
- ot_lhash GHashTable *commits_to_fetch = NULL;
- ot_lfree char *branch_rev = NULL;
- ot_lfree char *remote_mode_str = NULL;
+ gs_free char *remote_key = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
+ gs_free char *remote_config_content = NULL;
+ gs_free char *path = NULL;
+ gs_free char *baseurl = NULL;
+ gs_free char *summary_data = NULL;
+ gs_unref_hashtable GHashTable *requested_refs_to_fetch = NULL;
+ gs_unref_hashtable GHashTable *updated_refs = NULL;
+ gs_unref_hashtable GHashTable *commits_to_fetch = NULL;
+ gs_free char *branch_rev = NULL;
+ gs_free char *remote_mode_str = NULL;
OtPullData pull_data_real;
OtPullData *pull_data = &pull_data_real;
SoupURI *summary_uri = NULL;
{
const char *ref = key;
const char *sha256 = value;
- ot_lfree char *key = NULL;
- ot_lfree char *remote_ref = NULL;
- ot_lfree char *baseurl = NULL;
- ot_lfree char *original_rev = NULL;
+ gs_free char *key = NULL;
+ gs_free char *remote_ref = NULL;
+ gs_free char *baseurl = NULL;
+ gs_free char *original_rev = NULL;
remote_ref = g_strdup_printf ("%s/%s", pull_data->remote_name, ref);
{
const char *ref = key;
const char *checksum = value;
- ot_lfree char *remote_ref = NULL;
+ gs_free char *remote_ref = NULL;
remote_ref = g_strdup_printf ("%s/%s", pull_data->remote_name, ref);
GOptionContext *context;
gboolean ret = FALSE;
gs_free char *booted_osname = NULL;
- ot_lobj GFile *repo_path = NULL;
+ gs_unref_object GFile *repo_path = NULL;
gs_unref_object OtDeployment *deployment = NULL;
gs_unref_object GFile *deployment_dir = NULL;
- ot_lobj GFile *deploy_parent = NULL;
- ot_lptrarray GPtrArray *modified = NULL;
- ot_lptrarray GPtrArray *removed = NULL;
- ot_lptrarray GPtrArray *added = NULL;
+ gs_unref_object GFile *deploy_parent = NULL;
+ gs_unref_ptrarray GPtrArray *modified = NULL;
+ gs_unref_ptrarray GPtrArray *removed = NULL;
+ gs_unref_ptrarray GPtrArray *added = NULL;
gs_unref_ptrarray GPtrArray *deployments = NULL;
- ot_lobj GFile *orig_etc_path = NULL;
- ot_lobj GFile *new_etc_path = NULL;
+ gs_unref_object GFile *orig_etc_path = NULL;
+ gs_unref_object GFile *new_etc_path = NULL;
__attribute__((unused)) GCancellable *cancellable = NULL;
int bootversion;
{
GOptionContext *context;
gboolean ret = FALSE;
- ot_lobj GFile *dir = NULL;
- ot_lobj GFile *child = NULL;
+ gs_unref_object GFile *dir = NULL;
+ gs_unref_object GFile *child = NULL;
guint i;
const char *normal_toplevels[] = {"boot", "dev", "home", "proc", "run", "sys"};
GCancellable *cancellable = NULL;
gboolean ret = FALSE;
const char *keyfile_arg = NULL;
const char *treename_arg = NULL;
- ot_lobj GFile *deploy_dir = NULL;
- ot_lobj GFile *osdir = NULL;
- ot_lobj GFile *dest_osconfig_path = NULL;
+ gs_unref_object GFile *deploy_dir = NULL;
+ gs_unref_object GFile *osdir = NULL;
+ gs_unref_object GFile *dest_osconfig_path = NULL;
gs_unref_ptrarray GPtrArray *subproc_args = NULL;
- ot_lfree char *osname = NULL;
- ot_lfree char *repoarg = NULL;
- ot_lfree char *ostree_dir_arg = NULL;
- ot_lfree char *tree_to_deploy = NULL;
+ gs_free char *osname = NULL;
+ gs_free char *repoarg = NULL;
+ gs_free char *ostree_dir_arg = NULL;
+ gs_free char *tree_to_deploy = NULL;
GKeyFile *keyfile = NULL;
__attribute__((unused)) GCancellable *cancellable = NULL;
if (g_str_has_prefix (keyfile_arg, "http://") || g_str_has_prefix (keyfile_arg, "https://"))
{
- ot_lobj GFile *tmp = g_file_new_for_path (g_get_tmp_dir ());
- ot_lobj OstreeCurlFetcher *fetcher = ostree_curl_fetcher_new (tmp);
+ gs_unref_object GFile *tmp = g_file_new_for_path (g_get_tmp_dir ());
+ gs_unref_object OstreeCurlFetcher *fetcher = ostree_curl_fetcher_new (tmp);
g_print ("Fetching %s...\n", keyfile_arg);
ostree_curl_fetcher_request_uri_async (fetcher, keyfile_arg, cancellable,
NULL);
{
- ot_lfree char *repourl = NULL;
+ gs_free char *repourl = NULL;
repourl = g_key_file_get_string (keyfile, "os", "Repo", error);
if (!repourl)
GOptionContext *context;
gboolean ret = FALSE;
const char *osname = NULL;
- ot_lobj GFile *deploy_dir = NULL;
- ot_lobj GFile *dir = NULL;
+ gs_unref_object GFile *deploy_dir = NULL;
+ gs_unref_object GFile *dir = NULL;
__attribute__((unused)) GCancellable *cancellable = NULL;
context = g_option_context_new ("OSNAME - Initialize empty state for given operating system");
GOptionContext *context;
gboolean ret = FALSE;
const char *osname;
- ot_lobj GFile *repo_path = NULL;
- ot_lobj GFile *deploy_dir = NULL;
- ot_lobj GFile *current_deployment = NULL;
- ot_lobj GFile *previous_deployment = NULL;
- ot_lobj GFile *active_deployment = NULL;
+ gs_unref_object GFile *repo_path = NULL;
+ gs_unref_object GFile *deploy_dir = NULL;
+ gs_unref_object GFile *current_deployment = NULL;
+ gs_unref_object GFile *previous_deployment = NULL;
+ gs_unref_object GFile *active_deployment = NULL;
gs_free char *active_osname = NULL;
__attribute__((unused)) GCancellable *cancellable = NULL;
if (!opt_no_repo_prune)
{
- ot_lfree char *repo_arg = NULL;
+ gs_free char *repo_arg = NULL;
repo_arg = g_strconcat ("--repo=", gs_file_get_path_cached (repo_path), NULL);
{
GOptionContext *context;
gboolean ret = FALSE;
- ot_lobj GFile *rootdir = NULL;
+ gs_unref_object GFile *rootdir = NULL;
__attribute__((unused)) GCancellable *cancellable = NULL;
context = g_option_context_new ("[ROOT] - Run triggers (regenerate caches, etc.)");
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFileInfo *src_info = NULL;
- ot_lobj GFile *dest = NULL;
- ot_lobj GFile *parent = NULL;
- ot_lfree char *relative_path = NULL;
+ gs_unref_object GFileInfo *src_info = NULL;
+ gs_unref_object GFile *dest = NULL;
+ gs_unref_object GFile *parent = NULL;
+ gs_free char *relative_path = NULL;
relative_path = g_file_get_relative_path (modified_etc, src);
g_assert (relative_path);
if (g_file_info_get_file_type (src_info) == G_FILE_TYPE_DIRECTORY)
{
- ot_lobj GFileEnumerator *src_enum = NULL;
- ot_lobj GFileInfo *child_info = NULL;
+ gs_unref_object GFileEnumerator *src_enum = NULL;
+ gs_unref_object GFileInfo *child_info = NULL;
GError *temp_error = NULL;
/* FIXME actually we need to copy permissions and xattrs */
while ((child_info = g_file_enumerator_next_file (src_enum, cancellable, error)) != NULL)
{
- ot_lobj GFile *child = g_file_get_child (src, g_file_info_get_name (child_info));
+ gs_unref_object GFile *child = g_file_get_child (src, g_file_info_get_name (child_info));
if (!copy_one_config_file (orig_etc, modified_etc, new_etc, child,
cancellable, error))
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFile *ostree_etc = NULL;
- ot_lobj GFile *tmp_etc = NULL;
- ot_lptrarray GPtrArray *modified = NULL;
- ot_lptrarray GPtrArray *removed = NULL;
- ot_lptrarray GPtrArray *added = NULL;
+ gs_unref_object GFile *ostree_etc = NULL;
+ gs_unref_object GFile *tmp_etc = NULL;
+ gs_unref_ptrarray GPtrArray *modified = NULL;
+ gs_unref_ptrarray GPtrArray *removed = NULL;
+ gs_unref_ptrarray GPtrArray *added = NULL;
guint i;
modified = g_ptr_array_new_with_free_func ((GDestroyNotify) ostree_diff_item_unref);
for (i = 0; i < removed->len; i++)
{
GFile *file = removed->pdata[i];
- ot_lobj GFile *target_file = NULL;
- ot_lfree char *path = NULL;
+ gs_unref_object GFile *target_file = NULL;
+ gs_free char *path = NULL;
path = g_file_get_relative_path (orig_etc, file);
g_assert (path);
dir = ot_gfile_get_child_build_path (ostree_dir, "repo", "objects", NULL);
if (!g_file_query_exists (dir, NULL))
{
- ot_lfree char *opt_repo_arg = g_strdup_printf ("--repo=%s/repo",
+ gs_free char *opt_repo_arg = g_strdup_printf ("--repo=%s/repo",
gs_file_get_path_cached (ostree_dir));
if (!gs_subprocess_simple_run_sync (NULL, GS_SUBPROCESS_STREAM_DISPOSITION_NULL,
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GInputStream *in = NULL;
+ gs_unref_object GInputStream *in = NULL;
in = (GInputStream*)g_file_read (f, cancellable, error);
if (!in)
int i;
GCancellable *cancellable = NULL;
const char *rev;
- ot_lobj OstreeRepo *repo = NULL;
- ot_lobj GOutputStream *stdout_stream = NULL;
- ot_lobj GFile *root = NULL;
- ot_lobj GFile *f = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
+ gs_unref_object GOutputStream *stdout_stream = NULL;
+ gs_unref_object GFile *root = NULL;
+ gs_unref_object GFile *f = NULL;
context = g_option_context_new ("COMMIT PATH [PATH...] - Concatenate contents of files");
g_option_context_add_main_entries (context, options, NULL);
gboolean ret = FALSE;
ProcessOneCheckoutData data;
GError *tmp_error = NULL;
- ot_lobj OstreeRepoFile *root = NULL;
- ot_lobj OstreeRepoFile *subtree = NULL;
- ot_lobj GFileInfo *file_info = NULL;
+ gs_unref_object OstreeRepoFile *root = NULL;
+ gs_unref_object OstreeRepoFile *subtree = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
memset (&data, 0, sizeof (data));
gboolean ret = FALSE;
gsize len;
GError *temp_error = NULL;
- ot_lobj GInputStream *instream = NULL;
- ot_lobj GDataInputStream *datastream = NULL;
- ot_lfree char *revision = NULL;
- ot_lfree char *subpath = NULL;
- ot_lfree char *resolved_commit = NULL;
+ gs_unref_object GInputStream *instream = NULL;
+ gs_unref_object GDataInputStream *datastream = NULL;
+ gs_free char *revision = NULL;
+ gs_free char *subpath = NULL;
+ gs_free char *resolved_commit = NULL;
if (opt_from_stdin)
{
}
else
{
- ot_lobj GFile *f = g_file_new_for_path (opt_from_file);
+ gs_unref_object GFile *f = g_file_new_for_path (opt_from_file);
instream = (GInputStream*)g_file_read (f, cancellable, error);
if (!instream)
gboolean ret = FALSE;
const char *commit;
const char *destination;
- ot_lobj OstreeRepo *repo = NULL;
- ot_lfree char *existing_commit = NULL;
- ot_lfree char *resolved_commit = NULL;
- ot_lfree char *tmp_destination = NULL;
- ot_lobj GFileInfo *symlink_file_info = NULL;
- ot_lobj GFile *checkout_target = NULL;
- ot_lobj GFile *checkout_target_tmp = NULL;
- ot_lobj GFile *symlink_target = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
+ gs_free char *existing_commit = NULL;
+ gs_free char *resolved_commit = NULL;
+ gs_free char *tmp_destination = NULL;
+ gs_unref_object GFileInfo *symlink_file_info = NULL;
+ gs_unref_object GFile *checkout_target = NULL;
+ gs_unref_object GFile *checkout_target_tmp = NULL;
+ gs_unref_object GFile *symlink_target = NULL;
context = g_option_context_new ("COMMIT DESTINATION - Check out a commit into a filesystem tree");
g_option_context_add_main_entries (context, options, NULL);
GAsyncResult *result,
gpointer user_data)
{
- ot_lfree guchar *csum = NULL;
- ot_lfree char *checksum = NULL;
+ gs_free guchar *csum = NULL;
+ gs_free char *checksum = NULL;
AsyncChecksumData *data = user_data;
if (ostree_checksum_file_async_finish ((GFile*)obj, result, &csum, data->error))
{
GOptionContext *context;
gboolean ret = FALSE;
- ot_lobj GFile *f = NULL;
+ gs_unref_object GFile *f = NULL;
AsyncChecksumData data;
context = g_option_context_new ("FILENAME - Checksum a file or directory");
gboolean ret = FALSE;
gsize len;
char **iter = NULL; /* nofree */
- ot_lhash GHashTable *ret_hash = NULL;
- ot_lobj GFile *path = NULL;
- ot_lfree char *contents = NULL;
+ gs_unref_hashtable GHashTable *ret_hash = NULL;
+ gs_unref_object GFile *path = NULL;
+ gs_free char *contents = NULL;
char **lines = NULL;
path = g_file_new_for_path (statoverride_file);
gboolean ret = FALSE;
gsize len;
char **iter = NULL; /* nofree */
- ot_lhash GHashTable *ret_hash = NULL;
- ot_lvariant GVariant *ret_related_objects = NULL;
- ot_lobj GFile *path = NULL;
- ot_lfree char *contents = NULL;
+ gs_unref_hashtable GHashTable *ret_hash = NULL;
+ gs_unref_variant GVariant *ret_related_objects = NULL;
+ gs_unref_object GFile *path = NULL;
+ gs_free char *contents = NULL;
GVariantBuilder builder;
gboolean builder_initialized = FALSE;
char **lines = NULL;
{
const char *line = *iter;
const char *spc;
- ot_lfree char *name = NULL;
+ gs_free char *name = NULL;
if (!*line)
break;
gboolean skip_commit = FALSE;
gboolean in_transaction = FALSE;
GCancellable *cancellable = NULL;
- ot_lobj OstreeRepo *repo = NULL;
- ot_lobj GFile *arg = NULL;
- ot_lfree char *parent = NULL;
- ot_lfree char *commit_checksum = NULL;
- ot_lvariant GVariant *parent_commit = NULL;
- ot_lvariant GVariant *metadata = NULL;
- ot_lvariant GVariant *related_objects = NULL;
- ot_lobj GFile *metadata_f = NULL;
- ot_lfree char *contents_checksum = NULL;
- ot_lobj OstreeMutableTree *mtree = NULL;
- ot_lfree char *tree_type = NULL;
- ot_lhash GHashTable *mode_adds = NULL;
- ot_lvariant GVariant *parent_content_csum_v = NULL;
- ot_lvariant GVariant *parent_metadata_csum_v = NULL;
- ot_lfree char *parent_content_checksum = NULL;
- ot_lfree char *parent_metadata_checksum = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
+ gs_unref_object GFile *arg = NULL;
+ gs_free char *parent = NULL;
+ gs_free char *commit_checksum = NULL;
+ gs_unref_variant GVariant *parent_commit = NULL;
+ gs_unref_variant GVariant *metadata = NULL;
+ gs_unref_variant GVariant *related_objects = NULL;
+ gs_unref_object GFile *metadata_f = NULL;
+ gs_free char *contents_checksum = NULL;
+ gs_unref_object OstreeMutableTree *mtree = NULL;
+ gs_free char *tree_type = NULL;
+ gs_unref_hashtable GHashTable *mode_adds = NULL;
+ gs_unref_variant GVariant *parent_content_csum_v = NULL;
+ gs_unref_variant GVariant *parent_metadata_csum_v = NULL;
+ gs_free char *parent_content_checksum = NULL;
+ gs_free char *parent_metadata_checksum = NULL;
OstreeRepoCommitModifier *modifier = NULL;
GMappedFile *metadata_mappedf = NULL;
GVariantBuilder metadata_builder;
{
const char *s;
const char *eq;
- ot_lfree char *key = NULL;
+ gs_free char *key = NULL;
s = *iter;
const char *op;
const char *section_key;
const char *value;
- ot_lobj OstreeRepo *repo = NULL;
- ot_lfree char *section = NULL;
- ot_lfree char *key = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
+ gs_free char *section = NULL;
+ gs_free char *key = NULL;
GKeyFile *config = NULL;
context = g_option_context_new ("- Change configuration settings");
else if (!strcmp (op, "get"))
{
GKeyFile *readonly_config = NULL;
- ot_lfree char *value = NULL;
+ gs_free char *value = NULL;
if (argc < 3)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
GError **error)
{
gboolean ret = FALSE;
- ot_lfree GFile *ret_file = NULL;
+ gs_free GFile *ret_file = NULL;
if (g_str_has_prefix (arg, "/")
|| g_str_has_prefix (arg, "./")
GCancellable *cancellable = NULL;
const char *src;
const char *target;
- ot_lobj OstreeRepo *repo = NULL;
- ot_lfree char *src_prev = NULL;
- ot_lobj GFile *srcf = NULL;
- ot_lobj GFile *targetf = NULL;
- ot_lobj GFile *cwd = NULL;
- ot_lptrarray GPtrArray *modified = NULL;
- ot_lptrarray GPtrArray *removed = NULL;
- ot_lptrarray GPtrArray *added = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
+ gs_free char *src_prev = NULL;
+ gs_unref_object GFile *srcf = NULL;
+ gs_unref_object GFile *targetf = NULL;
+ gs_unref_object GFile *cwd = NULL;
+ gs_unref_ptrarray GPtrArray *modified = NULL;
+ gs_unref_ptrarray GPtrArray *removed = NULL;
+ gs_unref_ptrarray GPtrArray *added = NULL;
context = g_option_context_new ("REV TARGETDIR - Compare directory TARGETDIR against revision REV");
g_option_context_add_main_entries (context, options, NULL);
gboolean ret = FALSE;
GHashTableIter hash_iter;
gpointer key, value;
- ot_lhash GHashTable *reachable_objects = NULL;
- ot_lobj GInputStream *input = NULL;
- ot_lobj GFileInfo *file_info = NULL;
- ot_lvariant GVariant *xattrs = NULL;
- ot_lvariant GVariant *metadata = NULL;
- ot_lfree guchar *computed_csum = NULL;
- ot_lfree char *tmp_checksum = NULL;
+ gs_unref_hashtable GHashTable *reachable_objects = NULL;
+ gs_unref_object GInputStream *input = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
+ gs_unref_variant GVariant *xattrs = NULL;
+ gs_unref_variant GVariant *metadata = NULL;
+ gs_free guchar *computed_csum = NULL;
+ gs_free char *tmp_checksum = NULL;
reachable_objects = ostree_traverse_new_reachable ();
GCancellable *cancellable = NULL;
GHashTableIter hash_iter;
gpointer key, value;
- ot_lobj OstreeRepo *repo = NULL;
- ot_lhash GHashTable *objects = NULL;
- ot_lhash GHashTable *commits = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
+ gs_unref_hashtable GHashTable *objects = NULL;
+ gs_unref_hashtable GHashTable *commits = NULL;
context = g_option_context_new ("- Check the repository for consistency");
g_option_context_add_main_entries (context, options, NULL);
gboolean ret = FALSE;
__attribute__ ((unused)) GCancellable *cancellable = NULL;
const char *mode_str = "bare";
- ot_lobj GFile *child = NULL;
- ot_lobj GFile *grandchild = NULL;
- ot_lobj OstreeRepo *repo = NULL;
+ gs_unref_object GFile *child = NULL;
+ gs_unref_object GFile *grandchild = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
GString *config_data = NULL;
context = g_option_context_new ("- Initialize a new empty repository");
GOptionContext *context;
gboolean ret = FALSE;
const char *rev;
- ot_lobj OstreeRepo *repo = NULL;
- ot_lobj GOutputStream *pager = NULL;
- ot_lvariant GVariant *commit = NULL;
- ot_lfree char *resolved_rev = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
+ gs_unref_object GOutputStream *pager = NULL;
+ gs_unref_variant GVariant *commit = NULL;
+ gs_free char *resolved_rev = NULL;
context = g_option_context_new ("- Show revision log");
g_option_context_add_main_entries (context, options, NULL);
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFileEnumerator *dir_enum = NULL;
- ot_lobj GFile *child = NULL;
- ot_lobj GFileInfo *child_info = NULL;
+ gs_unref_object GFileEnumerator *dir_enum = NULL;
+ gs_unref_object GFile *child = NULL;
+ gs_unref_object GFileInfo *child_info = NULL;
GError *temp_error = NULL;
dir_enum = g_file_enumerate_children (f, OSTREE_GIO_FAST_QUERYINFO,
{
GOptionContext *context;
gboolean ret = FALSE;
- ot_lobj OstreeRepo *repo = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
const char *rev;
int i;
- ot_lobj GFile *root = NULL;
- ot_lobj GFile *f = NULL;
- ot_lobj GFileInfo *file_info = NULL;
+ gs_unref_object GFile *root = NULL;
+ gs_unref_object GFile *f = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
context = g_option_context_new ("COMMIT PATH [PATH...] - List file paths");
g_option_context_add_main_entries (context, options, NULL);
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFile *content_path = NULL;
- ot_lobj GFileInfo *archive_info = NULL;
+ gs_unref_object GFile *content_path = NULL;
+ gs_unref_object GFileInfo *archive_info = NULL;
if (objtype == OSTREE_OBJECT_TYPE_FILE)
{
guint64 length;
- ot_lobj GInputStream *file_object = NULL;
- ot_lobj GInputStream *input = NULL;
- ot_lobj GFileInfo *file_info = NULL;
- ot_lvariant GVariant *xattrs = NULL;
+ gs_unref_object GInputStream *file_object = NULL;
+ gs_unref_object GInputStream *input = NULL;
+ gs_unref_object GFileInfo *file_info = NULL;
+ gs_unref_variant GVariant *xattrs = NULL;
if (!ostree_repo_load_file (data->src_repo, checksum,
&input, &file_info, &xattrs,
}
else
{
- ot_lvariant GVariant *metadata = NULL;
+ gs_unref_variant GVariant *metadata = NULL;
if (!ostree_repo_load_variant (data->src_repo, objtype, checksum, &metadata,
error))
gpointer user_data)
{
OtLocalCloneData *data = user_data;
- ot_lvariant GVariant *serialized_key = object;
+ gs_unref_variant GVariant *serialized_key = object;
GError *local_error = NULL;
GError **error = &local_error;
const char *checksum;
int i;
GHashTableIter hash_iter;
gpointer key, value;
- ot_lhash GHashTable *objects = NULL;
- ot_lobj GFile *src_f = NULL;
- ot_lobj GFile *src_repo_dir = NULL;
- ot_lobj GFile *dest_repo_dir = NULL;
- ot_lobj GFile *src_dir = NULL;
- ot_lobj GFile *dest_dir = NULL;
- ot_lhash GHashTable *refs_to_clone = NULL;
- ot_lhash GHashTable *commits_to_clone = NULL;
- ot_lhash GHashTable *source_objects = NULL;
- ot_lhash GHashTable *objects_to_copy = NULL;
+ gs_unref_hashtable GHashTable *objects = NULL;
+ gs_unref_object GFile *src_f = NULL;
+ gs_unref_object GFile *src_repo_dir = NULL;
+ gs_unref_object GFile *dest_repo_dir = NULL;
+ gs_unref_object GFile *src_dir = NULL;
+ gs_unref_object GFile *dest_dir = NULL;
+ gs_unref_hashtable GHashTable *refs_to_clone = NULL;
+ gs_unref_hashtable GHashTable *commits_to_clone = NULL;
+ gs_unref_hashtable GHashTable *source_objects = NULL;
+ gs_unref_hashtable GHashTable *objects_to_copy = NULL;
OtLocalCloneData datav;
OtLocalCloneData *data = &datav;
gboolean ret = FALSE;
const char *op;
guint i;
- ot_lobj OstreeRepo *repo = NULL;
- ot_lptrarray GPtrArray *branches = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
+ gs_unref_ptrarray GPtrArray *branches = NULL;
GKeyFile *config = NULL;
context = g_option_context_new ("OPERATION [args] - Control remote repository configuration");
gboolean ret = FALSE;
const char *rev = "master";
int i;
- ot_lobj OstreeRepo *repo = NULL;
- ot_lfree char *resolved_rev = NULL;
- ot_lvariant GVariant *variant = NULL;
- ot_lfree char *formatted_variant = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
+ gs_free char *resolved_rev = NULL;
+ gs_unref_variant GVariant *variant = NULL;
+ gs_free char *formatted_variant = NULL;
context = g_option_context_new ("REV - Output the target of a rev");
g_option_context_add_main_entries (context, options, NULL);
static void
print_variant (GVariant *variant)
{
- ot_lfree char *formatted_variant = NULL;
- ot_lvariant GVariant *byteswapped = NULL;
+ gs_free char *formatted_variant = NULL;
+ gs_unref_variant GVariant *byteswapped = NULL;
if (G_BYTE_ORDER != G_BIG_ENDIAN)
{
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFile *f = NULL;
- ot_lvariant GVariant *variant = NULL;
+ gs_unref_object GFile *f = NULL;
+ gs_unref_variant GVariant *variant = NULL;
f = g_file_new_for_path (filename);
char buf[8192];
gsize bytes_read;
OstreeObjectType objtype;
- ot_lvariant GVariant *variant = NULL;
- ot_lobj GFile *object_path = NULL;
- ot_lobj GInputStream *in = NULL;
+ gs_unref_variant GVariant *variant = NULL;
+ gs_unref_object GFile *object_path = NULL;
+ gs_unref_object GInputStream *in = NULL;
for (objtype = OSTREE_OBJECT_TYPE_FILE; objtype <= OSTREE_OBJECT_TYPE_COMMIT; objtype++)
{
{
gboolean ret = FALSE;
const char *name;
- ot_lvariant GVariant *csum_v = NULL;
- ot_lvariant GVariant *variant = NULL;
- ot_lvariant GVariant *related = NULL;
+ gs_unref_variant GVariant *csum_v = NULL;
+ gs_unref_variant GVariant *variant = NULL;
+ gs_unref_variant GVariant *related = NULL;
GVariantIter *viter = NULL;
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT,
while (g_variant_iter_loop (viter, "(&s@ay)", &name, &csum_v))
{
- ot_lfree char *checksum = ostree_checksum_from_bytes_v (csum_v);
+ gs_free char *checksum = ostree_checksum_from_bytes_v (csum_v);
g_print ("%s %s\n", name, checksum);
}
csum_v = NULL;
{
gboolean ret = FALSE;
const char *value;
- ot_lvariant GVariant *commit = NULL;
- ot_lvariant GVariant *metadata = NULL;
+ gs_unref_variant GVariant *commit = NULL;
+ gs_unref_variant GVariant *metadata = NULL;
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT,
resolved_rev, &commit, error))
GOptionContext *context;
gboolean ret = FALSE;
const char *rev;
- ot_lobj OstreeRepo *repo = NULL;
- ot_lfree char *resolved_rev = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
+ gs_free char *resolved_rev = NULL;
context = g_option_context_new ("OBJECT - Output a metadata object");
g_option_context_add_main_entries (context, options, NULL);
GCancellable *cancellable = NULL;
GError *temp_error = NULL;
gsize len;
- ot_lobj OstreeRepo *repo = NULL;
- ot_lobj GInputStream *instream = NULL;
- ot_lobj GDataInputStream *datastream = NULL;
- ot_lfree char *line = NULL;
+ gs_unref_object OstreeRepo *repo = NULL;
+ gs_unref_object GInputStream *instream = NULL;
+ gs_unref_object GDataInputStream *datastream = NULL;
+ gs_free char *line = NULL;
context = g_option_context_new ("Import newline-separated pairs of REF REVISION");
g_option_context_add_main_entries (context, options, NULL);
cancellable, &temp_error)) != NULL)
{
const char *spc = strchr (line, ' ');
- ot_lfree char *ref = NULL;
- ot_lfree guchar *rev = NULL;
+ gs_free char *ref = NULL;
+ gs_free guchar *rev = NULL;
if (!spc || spc == line)
{
if (!command->fn)
{
- ot_lfree char *msg = g_strdup_printf ("Unknown command '%s'", cmd);
+ gs_free char *msg = g_strdup_printf ("Unknown command '%s'", cmd);
g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, msg);
goto out;
}